<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
  <%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Client Profile</title>
<link rel="stylesheet" type="text/css" href="css/style-old.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddaccordion.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/niceforms-default.css" />

<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader",
	contentclass: "submenu", 
	revealtype: "click", 
	mouseoverdelay: 200, 
	collapseprev: true, 
	defaultexpanded: [], 
	onemustopen: false, 
	animatedefault: false, 
	persiststate: true, 
	toggleclass: ["", ""], 
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"],
	animatespeed: "fast", 
	oninit:function(headers, expandedindices){ 
	},
	onopenclose:function(header, index, state, isuseractivated){
	}
});
var profitloss=0;
 
	$(document).ready(function() {
	$.ajax({
			url : '/nepalcmx/mock/bank',
			dataType: "json",
			contentType: 'application/json',			  
			success : function(jsonData) {
				for(var a in jsonData){
				document.getElementById("closeb").innerHTML = jsonData[a]["cashl"];
				document.getElementById("totm").innerHTML = jsonData[a]["marginl"];
				document.getElementById("depf").innerHTML =jsonData[a]["creditamt"];
				document.getElementById("utim").innerHTML = jsonData[a]["margin_u"];
				document.getElementById("withf").innerHTML =jsonData[a]["debitamt"];
				document.getElementById("balm").innerHTML = jsonData[a]["margin_b"];
				document.getElementById("tot").innerHTML =Number(jsonData[a]["cashl"])+profitloss;
				}}
		});
		
		$.ajax({
			url : '/nepalcmx/ProfitLossUser',
			dataType: "json",
			contentType: 'application/json',			  
			success : function(responseJson) {
				var m=0,n=0;
				for(var a in responseJson){
					 m=m+(Number(responseJson[a]["lot1"])*Number(responseJson[a]["price1"]));
					 n=n+(Number(responseJson[a]["lot1"])*Number(responseJson[a]["price2"]));
					 profitloss=m-n;
				 }
					 document.getElementById("netp").innerHTML=profitloss;
					}
	});
		
		$.ajax({
			url : './mock/clientpage',
			dataType: "json",
			contentType: 'application/json',			  
			success : function(jsonData) {
				for(var a in jsonData){
					for(var b in jsonData[a]){
						var name=jsonData[a]["fname"]+" "+jsonData[a]["mname"]+" "+jsonData[a]["lname"];
						document.getElementById("id").innerHTML = jsonData[a]["userId"];
						document.getElementById("cname").innerHTML =name;
						document.getElementById("mobile").innerHTML =jsonData[a]["mobile"];
					}
				}
			}
		});
	});
	

function prof()
{
if (container1.style.display=="none") container1.style.display="block"; 
else container1.style.display="block";
}
	
	function logout(){
		alert("You are Logout SuccessFully");
		}
</script>
</head>
<body>
  <%@ include file="header.jsp" %>	
    
    <div class="main_content">
    
                    <div class="menu">
                    <ul>
                    <li>LoginID : <sec:authentication property="principal.username" /></li>
                    <li><a href="#">Exchange :
                       <select style="height:15px;font-size:9px;"><option>NMCEX</option></select></a>
               
                    </li>
                    <li><a href="#">Login Type : Client</a>
                 
                    <li><a href="#">Segment : <select style="height:16px;font-size:9px;"><option>commodity mkt(13-14)</option></select>
                  </a>
                       
                    </li>
                  
                    </ul>
                    </div> 
                   
    <div class="center_content">  
    <div class="left_content">
    <div class="sidebar_search">
            <form>
            <input type="text" name="" class="search_input" value="search keyword" onclick="this.value=''" />
            <input type="image" class="search_submit" src="images/search.png" />
            </form>            
            </div>
    
            <div class="sidebarmenu">
            
                <a class="menuitem submenuheader" href="">Profile</a>
                <div class="submenu">
                    <ul>
                    <li onclick="prof('container1');"><a href="clientpage">Directory</a></li>
               
                    </ul>
                </div>
                <a class="menuitem submenuheader" href="" >Financial</a>
                <div class="submenu">
                    <ul>
                    <li><a href="drcr">Dr./Cr. Summary</a></li>
                    <li><a href="fenlgr">Financial Ledger</a></li>
                   <!--  <li><a href="agingreport">Ageing</a></li> -->
                    
                    </ul>
                </div>
                <a class="menuitem submenuheader" href="">Reports</a>
                <div class="submenu">
                    <ul>
                    <li><a href="tradeconf">Trade Conf.</a></li>
                   
                    <li><a href="netpos">N.Pos(As on)</a></li>
                 
                    <li><a href="clientport">PortFolio</a></li>
                    <li><a href="bills">Bills</a></li>
                   
                    
                    </ul>
                </div>
                <a class="menuitem submenuheader" href="">Downloads</a>
                 <div class="submenu">
                    <ul>
                   <li><a href="oct_hn.pdf">Downloads</a></li>
                    <li><a href="TB_Trading_Regulations.pdf">Reports</a></li>
                    <li><a href="test5.csv">Digital</a></li>
                     </ul>
                </div>
                <a class="menuitem submenuheader" href="">Request</a>
                 <div class="submenu">
                    <ul>
                     <li ><a href="withdrawal">WithDrawal Request</a></li>
                    <li ><a href="clientfundview">Client Fund View</a></li>
                    <li ><a href="fundTransfer">Fund Transfer</a></li>
                    </ul>
                </div>
                <a class="menuitem submenuheader" href="">Admin Panel</a>
                 <div class="submenu">
                    <ul>
                   <li ><a href="nepalholiday">Nepal Holiday List</a></li>
                    </ul>
                </div>
               <a class="menuitem submenuheader" href="">Settings</a>
                 <div class="submenu">
                    <ul>
                    <li ><a href="changepwd">Password Change</a></li>
                    <li ><a href="transactionpwd">Transaction Password Change</a></li>
                    </ul>
                </div>
                    
            </div>
            
            
    
    </div>  
    
    <div id="container1" class="right_content" >            
<div style="text-align:center;">
<label style=" width:100%;font-size:16px;" ><font color="#663380"><b><i>Client Fund View</i></b></font></label>
<label style="margin-right:5px; float:right;" ></label>
</div><br/>
  <table width="100%" border="1" cellpadding="0" cellspacing="0" style="font-family:helvetica;">
  <tr ><td align="center" colspan="2"><b>Client Details:</b><label id="id">&nbsp; </label>&nbsp;/&nbsp;<label id="cname"></label>&nbsp;/&nbsp;<label id="mobile"></label></td></tr>    
 <tr>
 <td align="center"><b>CASH FUND</b></td>
 
 <td align="center"><b>MARGINE FUND</b></td>
 </tr>
  <tr>
 <td align="center"></td>
 
 <td align="center"></td>
 </tr>	  <tr>
 <td align="center"></td>
 
 <td align="center"></td>
 </tr>	
 <tr>
 <td align="center" > Closing Balance : <label id="closeb"></label></td>

 <td align="center">Total Margine : <label id="totm"></label></td>
 
 </tr>
 <tr>
  <td align="center">Deposite Fund : <label id="depf"></label></td>

  <td align="center"> Utilized Margine : <label id="utim"></label></td>
 </tr>
  <tr>
  <td align="center">Withdrawal Fund : <label id="withf"></label></td>
<td align="center"> Balance Margine : <label id="balm"></label></td>
 
 </tr>
  <tr>
  <td align="center">Net Profit/Loss : <label id="netp"></label></td>
  <td align="center"></td>
 
 </tr>
  <tr>
  <td align="center">ToTal : <label id="tot"></label></td>
 <td align="center"> </td>
 
 </tr>
  </table></div>
 
  </div> 
    
    <div class="clear"></div>
    </div> 
  <%@ include file="footer.jsp" %>			
</body>
</html>